package com.ojoin.trade.common.web.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import com.ojoin.trade.common.web.dao.BaseDao;
import com.ojoin.trade.common.web.dao.DictDao;
import com.ojoin.trade.common.web.domain.Dict;
import com.ojoin.trade.common.web.service.DictService;

@Service
public class DictServiceImpl extends BaseServiceImpl<Dict> implements DictService {

	@Autowired
	private DictDao dictDao;
	
	@Override
	protected BaseDao<Dict> getBaseDao() {
		return dictDao;
	}


	/**
	 * 查询字段类型列表
	 * @return
	 */
	public List<String> findTypeList(){
		return dictDao.findTypeList(new Dict());
	}

	@Override
	public int save(Dict entity) {
		// 保存或更新实体
		if (entity.getIsNewRecord()){
			entity.preInsert();
			return dictDao.insert(entity);
		}else{
			entity.preUpdate();
			return dictDao.updateById(entity);
		}
	}

	 
}
